package com.lession.common;

import lombok.Getter;
import lombok.Setter;

//自定义异常类
@Setter
@Getter
public class LessionException extends RuntimeException {

    private String code;
    private String message;
    private String[] words;

    private LessionException() {
        super();
    }

    public LessionException(String code) {
        super(RetEnum.ReturnEnumUtil.getMsg(code));
        this.code = code;
        this.message = RetEnum.ReturnEnumUtil.getMsg(code);
    }

    public LessionException(String code, String[] words) {
        super(RetEnum.ReturnEnumUtil.getMsg(code));
        this.code = code;
        this.words = words;
    }

    public LessionException(String code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public LessionException(Throwable throwable) {
        super(throwable);
        this.initCause(throwable);
    }

    public LessionException(String code, Throwable throwable) {
        super(RetEnum.ReturnEnumUtil.getMsg(code));
        this.code = code;
        this.initCause(throwable);
    }

    public LessionException(String code, String[] words, Throwable throwable) {
        super();
        this.code = code;
        this.words = words;
        this.initCause(throwable);
    }

    public LessionException(String code, String message, Throwable throwable) {
        super(message);
        this.code = code;
        this.message = message;
        this.initCause(throwable);
    }

}
